package cn.webrx;

import java.text.NumberFormat;
import java.util.Locale;

public class NumberFormat1 {
    public static void main(String[] args) {
        //int num = 10;
        //System.out.printf("%.3f%n",(float)num);

        //格式化数字  //  1,242,412,423.316
        NumberFormat nf = NumberFormat.getInstance();

        //¥1,242,412,423.32
        //nf = NumberFormat.getCurrencyInstance(Locale.US);
        //System.out.println(nf.format(1242412423.315921));

        //格式化 57%
        nf = NumberFormat.getPercentInstance();
        System.out.println(nf.format(.56789));


        nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(3);


    }
}
